<template>
  <div class="fundodoo-goods-name-container">
    <div class="item">
      <span class="item-value item-name">{{ name }}</span>
    </div>
    <div class="item">
      <span class="item-label">价格:</span>
      <span class="item-value">{{ price }}</span>&nbsp;&nbsp;
      <span class="item-label">VIP价格:</span>
      <span class="item-value">{{ vipPrice }}</span>
    </div>
    <div class="item">
      <span class="item-label">分类:</span>
      <span class="item-value">{{ classification }}</span>
    </div>
    <div class="item">
      <span class="item-label">访客数:</span>
      <span class="item-value">{{ visitorVolume }}</span>
    </div>
    <div class="item">
      <span class="item-label">浏览数:</span>
      <span class="item-value">{{ pageviews }}</span>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'

export default Vue.extend({
  name: 'GoodsNameRenderer',
  components: {

  },
  props: {

  },
  data() {
    return {
      name: '',
      price: 0.00,
      vipPrice: 0.00,
      classification: '',
      visitorVolume: 0,
      pageviews: 0
    }
  },
  created() {

  },
  beforeMount() {
    this.getPreviewData()
  },
  methods: {
    getPreviewData() {
      this.name = this.params.value
      this.price = this.params.data.price.toFixed(2)
      this.vipPrice = this.params.data.vipPrice.toFixed(2)
      this.classification = this.params.data.cateName
      this.urvisitorVolumel = this.params.data.browse
      this.pageviews = this.params.data.browse
    },
    refresh(params) {
      if (params.value !== this.params.value) {
        this.params = params
      }
      return true
    }
  }
})
</script>

<style scoped>
  .fundodoo-goods-name-container,.item {
    display: flex;
    flex-direction: column;
    width: 100%;
    line-height: 18px;
  }
  .item {
    flex-direction: unset;
    font-size: 12px;
    line-height: 16px;
  }
  .item-label {
    padding-right: 3px;
    color: #908c8c;
  }
  .item-value {
    padding-right: 3px;
    color: #ffc107;
  }
  .item-name {
    color: #5b6bbd;
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 14px;
    font-weight: 700;
  }
</style>
